<template>
  <div>
    <div class="headLine">
      <el-card style="border-radius: 15px">
        <el-steps :active="actives" finish-status="success" align-center>
          <el-step title="步骤 1" description="选择预约老师并填写预约信息"></el-step>
          <el-step title="步骤 2" description="学生会见预约老师进行咨询"></el-step>
          <el-step title="步骤 3" description="咨询完成后由教师结束预约"></el-step>
        </el-steps>
      </el-card>
    </div>
    <div>
      <div v-show="show1" class="step-card">
        <Step1 @change1="isActive1" ref="step1"></Step1>
      </div>
      <div v-show="show2" class="step-card">
        <Step2 @change2="isActive2" ref="step2"></Step2>
      </div>
      <div v-show="show3" class="step-card">
        <Step3 @change3="isActive3" ref="step3"></Step3>
      </div>
    </div>
  </div>
</template>

<script>
import Step1 from '../common/process/Step1'
import Step2 from '../common/process/Step2'
import Step3 from '../common/process/Step3'

export default {
  name: 'StudentProcess',
  components: {Step1, Step2, Step3},
  data () {
    return {
      actives: 0,
      show1: true,
      show2: false,
      show3: false
    }
  },
  watch: {
    actives (newValue, oldValue) {
      if (newValue === 1) {
        this.show1 = true
        this.show2 = false
        this.show3 = false
      } else if (newValue === 2) {
        this.show1 = false
        this.show2 = true
        this.show3 = false
      } else if (newValue === 3) {
        this.show1 = false
        this.show2 = false
        this.show3 = true
      }
    }
  },
  methods: {
    isActive1 () {
      this.actives = 1
    },
    isActive2 () {
      this.actives = 2
    },
    isActive3 () {
      this.actives = 3
    }
  }
}
</script>

<style scoped>

.headLine {
  margin: 50px;
  padding: 0px 50px;
}

.step-card {
  margin: 30px;
}
</style>
